/*
 **************************************************************************
 * @author Armen
 * Made:Dec 10, 2009
 * 
 *  
 ************************************************************************** 
 */
package onlinecalsys.client.init;

import java.rmi.RemoteException;
import java.text.ParseException;

import onlinecalsys.client.controller.ClientController;
import onlinecalsys.client.view.MainView;
import onlinecalsys.client.view.View;
import onlinecalsys.client.view.gui.Error;
import onlinecalsys.client.view.gui.Login;
import onlinecalsys.server.objects.CalsysCalendar;

public class Onlinecalsys {
	
	/**
	 * The main method.
	 * This class start the whole program, first by openingen the login
	 * gui and making the login gui call the rest according to the validation 
	 * of the username and password
	 * 
	 * @param args the arguments
	 */
	public static void main(String[] args) {
			System.out.println("login");
			new Login(new Onlinecalsys());	
		
	}
	
	public void loginConfirmed(String username) {
		try {
			try {
				View view;
				System.out.println("1");
				view = MainView.getInstance(username);
				System.out.println("2");
				view.updateAppoinments(CalsysCalendar.today());
				System.out.println("3");
				view.getNote();
				System.out.println("4");
				
			} catch (RemoteException e) {
				new Error("no connection");
			}
			
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
